package io.geekidea.springbootplus.system.service.impl;

import io.geekidea.springbootplus.framework.common.service.impl.BaseServiceImpl;
import io.geekidea.springbootplus.system.entity.SysOrderDetails;
import io.geekidea.springbootplus.system.mapper.SysOrderDetailsMapper;
import io.geekidea.springbootplus.system.service.SysOrderDetailsService;
import io.geekidea.springbootplus.system.vo.SysMemberQueryVo;
import io.geekidea.springbootplus.system.vo.SysOrderDetailsQueryVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.List;
@Service
@Transactional(rollbackFor = Exception.class)
public class SysOrderDetailsServiceImpl extends BaseServiceImpl<SysOrderDetailsMapper, SysOrderDetails> implements SysOrderDetailsService {

    @Resource
    private SysOrderDetailsMapper sysOrderDetailsMapper;

    @Override
    public SysOrderDetailsQueryVo selectOrderDetailsById(Integer id) throws Exception {
        SysOrderDetailsQueryVo orderDetailsQueryVo = sysOrderDetailsMapper.selectOrderDetailsById(id);
        return orderDetailsQueryVo;
    }

    @Override
    public List<SysOrderDetailsQueryVo> selectOrderDetailsByOrderId(Long orderId) throws Exception{
        return sysOrderDetailsMapper.selectOrderDetailsByOrderId(orderId);
    }

    @Override
    public boolean deleteOrderDetails(Long id) throws Exception{
        return sysOrderDetailsMapper.deleteOrderDetails(id) > 0;
    }

    @Override
    public List<SysOrderDetailsQueryVo> selectOrderDetailsByProductName(String productName) throws Exception{
        return sysOrderDetailsMapper.selectOrderDetailsByProductName(productName);
    }

    @Override
    public List<SysOrderDetailsQueryVo> selectProductNameByProductPrice(BigDecimal productPrice) throws Exception{
        return sysOrderDetailsMapper.selectProductNameByProductPrice(productPrice);
    }
}
